<template>
	<el-form  :model="bedform" label-width="80px">
<el-form-item label="序号">
			<el-input v-model="bedform.patientId"></el-input>
		</el-form-item>
		<el-form-item label="床位号">
			<el-input v-model="bedform.bedId"></el-input>
		</el-form-item>
		<el-form-item label="房间号">
			<el-input v-model="bedform.houseId"></el-input>
		</el-form-item>
		
		<el-form-item label="起始日期">
			<el-date-picker
			  v-model="bedform.startdate"
			  type="date"
			  format="yyyy-MM-dd"
			  placeholder="选择日期">
			</el-date-picker>
		</el-form-item>
		<el-form-item label="结束日期">
			<el-date-picker
			  v-model="bedform.enddate"
			  type="date"
			  format="yyyy-MM-dd"
			  placeholder="选择日期">
			</el-date-picker>
		</el-form-item>
		<el-form-item label="床位详细信息">
			<el-input v-model="bedform.content"></el-input>
		</el-form-item>
		<el-button type="primary" @click="doEdit">提交</el-button>
	</el-form>
</template>

<script>
	export default{
		name:'Edit',
		props:{
			formData:{
				type:Object,
				default:()=>({})
			},
			editVisible:{
				type:Boolean,
			}
		},
		data(){
			return {
				bedform:{
					patientId:'',
					bedId:'',
					houseId:'',
					startdate:'',
					enddate:'',
					content:''
				}
			}
		},
		mounted(){
			this.bedform=this.formData;
			
		},
		methods:{
			doEdit(){
				this.postRequest("/bed/update",this.bedform).then(resp=>{
					if(resp){
						this.$emit("update:editVisible",false);
					}else{
						this.$message.error({message:'编辑失败'});
					}
				})
			}
		},
		watch:{
			formData:{
				deep:true,
				handler(newVal,oldVal){
					this.bedform=newVal
				}
			}
		}
	}
</script>

<style>
</style>
